#ifndef D3D10_UTILS_WAVES_H
#define D3D10_UTILS_WAVES_H

#include "d3dUtil.h"

namespace D3D10Utils
{
	class Waves
	{
	public:
		Waves(const UINT rows, const UINT columns);
		~Waves();

		void init(ID3D10Device * const device, const float cellSpacing, const float deltaTime, 
			const float speed, const float damping);

		void update(const float deltaTime);
		void disturb(const DWORD iRow, const DWORD jColumn, const float magnitude);
		void draw();		

	private:
		ID3D10Device *md3dDevice;
		ID3D10Buffer *mVertexBuffer;
		ID3D10Buffer *mIndexBuffer;

		D3DXVECTOR3 *mPrevSolution;
		D3DXVECTOR3 *mCurrSolution;

		D3DXVECTOR3 *mNormals;

		const DWORD mNumVertices;
		const DWORD mNumFaces;

		const UINT mRows;
		const UINT mColumns;

		// Simulation constants we can precompute.
		float mK1;
		float mK2;
		float mK3;

		float mTimeStep;
		float mSpatialStep;
	};
}

#endif // D3D10_UTILS_GRID_H
